import request from '@/utils/request.js'

// 获取登录用户资料
export const loginUser = () =>
  request({
    url: 'v1_0/user/profile',
    method: 'GET'
    // headers: {
    //   // 注意：该接口需要授权才能访问
    //   // token的数据格式：Bearer token数据，注意 Bearer 后面有个空格
    //   Authorization: `Bearer ${store.state.user.token}`
    // }
  })

// 获取用户资料
export const getUserInfo = () =>
  request({
    url: 'v1_0/user',
    method: 'GET'
  })

// 关注列表
export const getFollowings = params =>
  request({
    url: 'v1_0/user/followings',
    method: 'GET',
    params
  })

// 粉丝列表
export const getFollowers = params =>
  request({
    url: 'v1_0/user/followers',
    method: 'GET',
    params
  })

// 获取用户的统计数据
export const getFigure = () =>
  request({
    url: 'v1_0/user/figure',
    method: 'GET'
  })

// 获取用户频道
export const getUserChannels = () =>
  request({
    url: 'v1_0/user/channels',
    method: 'GET'
  })

// 用户收藏列表
export const getCollections = params => {
  return request({
    method: 'GET',
    url: 'v1_0/article/collections',
    params
  })
}

// 用户阅读历史
export const getHistory = params => {
  return request({
    method: 'GET',
    url: 'v1_0/user/histories',
    params
  })
}
